package state;

/**
 * Remarks:
 * Class name :Yied
 * Date :2023/2/14 17:04
 * Author:杨俊源
 */
public class Yield  {

    public static void main(String[] args) {
        MyYield myYield = new MyYield();
        new Thread(myYield,"a").start();
        new Thread(myYield,"b").start();
    }
}

class MyYield implements Runnable{
    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "线程开始");
        Thread.yield();
        System.out.println(Thread.currentThread().getName() + "线程停止");

    }
}
